<template>
    <pui-drawer show title="仿真工程管理器" position="left">
        <div class="resource-drawer-content">
            <div class="resource-tab">
                <div class="tabs-content">
                    <div class="tabs-tree">
                        <pui-tree :show="mainRef.treeShow" :dataList="mainRef.projectTree"></pui-tree>
                    </div>
                </div>
            </div>
        </div>
    </pui-drawer>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
    name: 'resource-content'
})
</script>
<script lang="ts" setup>
import { reactive, onMounted, watch } from 'vue'
const emit = defineEmits({
    onSearch: (val: any) => {},
    openExampleGraph: (val: any) => {},
})
const mainRef = reactive({
    treeShow: false,
    projectTree: [

    ]
}) as any

const init = (type: string) => {
    mainRef.projectTree = type === 'laser-line' ? [
        { label: '线形腔掺杂光纤激光器', value: '1', id: '1', children: [
            { label: '光隔离器1', value: '1', id: '1' },
            { label: '反射器R1', value: '1', id: '1' },
            { label: '泵浦源', value: '1', id: '1' },
            { label: '波分复用器', value: '1', id: '1' },
            { label: '掺饵光纤', value: '1', id: '1' },
            { label: '反射器R2', value: '1', id: '1' },
            { label: '光隔离器2', value: '1', id: '1' },
        ] },
    ] : mainRef.projectTree = type === 'laser-ring' ? [
        { label: '环形腔掺杂光纤激光器', value: '1', id: '1', children: [
            { label: '泵浦源+波分复用器', value: '1', id: '1' },
            { label: '隔离器', value: '1', id: '1' },
            { label: '掺饵光纤', value: '1', id: '1' },
            { label: '滤波器', value: '1', id: '1' },
            { label: '分光器', value: '1', id: '1' },
        ] },
    ] : [
        { label: '有源光纤放大器', value: '1', id: '1', children: [
            { label: '输入信号', value: '1', id: '1' },
            { label: '输入噪声', value: '1', id: '1' },
            { label: '光隔离器1', value: '1', id: '1' },
            { label: '泵浦源1+波分复用器1', value: '1', id: '1' },
            { label: '掺饵光纤', value: '1', id: '1' },
            { label: '泵浦源2+波分复用器2', value: '1', id: '1' },
            { label: '增益平坦滤波器', value: '1', id: '1' },
            { label: '光隔离器2', value: '1', id: '1' },
        ] },
    ]
    mainRef.treeShow = true
}
defineExpose({
    init
})
</script>